<!--
 * @Author: HeAo
 * @Date: 2022-08-25 19:23:21
 * @LastEditTime: 2022-08-25 19:28:53
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \JavaScripe\day-14BOM\02-WindowOpen.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button onclick="openWindow()">打开</button>
  <button onclick="closeWindow()">关闭</button>
  <script>
    function openWindow() {
      // window.open(URL,name,specs,replace)
      w = window.open('https://www.baidu.com', '_blank', 'width=300px,height=300px')
      // 调整窗口大小
      w = resizeTo(600, 400)
      // // 设置弹出窗口的默认位置
      w.moveTo(200, 200)

    }

    function closeWindow() {
      w.close()
    }
  </script>

</body>

</html>